<%@page import="com.wanmait.hotelManage.vo.Vip"%>
<%@page import="com.wanmait.hotelManage.vo.Pager"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DateFormat"%>
<%@page import="com.wanmait.hotelManage.vo.Userinfo"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
    String path=request.getContextPath();
    List<Vip> vips=(List<Vip>)request.getAttribute("vips");
    %>
<jsp:include page="/manage/inc/header.jsp"></jsp:include>
<jsp:include page="/manage/inc/menu.jsp"></jsp:include>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="<%=path%>/manage/index.jsp">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">会员管理</span></div>
        </div>
        <div class="result-wrap">
         <div class="result-title">
                    <div class="result-list">
                        <a href="<%=path%>/manage/vip/insert.jsp"><i class="icon-font"></i>新增会员</a>
                    </div>
                </div>
            <form name="myform" id="myform" method="post">
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th>ID</th>
                            <th>名称</th>
                            <th>购买价格</th>
                            <th>打折力度</th>
                            <th>录入时间</th>
                            <th>操作</th>
                        </tr>
                        <%
                        if(vips!=null){
                        	DateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        	for(int i=0;i<vips.size();i++){
                        		Vip vip=vips.get(i);
                        		String inputTime=df.format(vip.getInputTime());
                        		%>
                        	<tr id="tr<%=vip.getId()%>">
                            <td><%=vip.getId() %></td>
                            <td><%=vip.getTitle() %></td>
                            <td><%=vip.getPrice() %></td>
                            <td><%=vip.getDiscount() %></td>
                            <td><%=vip.getInputTime() %></td>
                            <td class="tt">
                                   <a class="link-update" href="<%=path%>/manage/VipServlet?action=updateInit&id=<%=vip.getId()%>">修改</a>
                                   <a class="link-del"  id="del<%=vip.getId()%>" href="#">删除</a>
                               </td>
                        </tr>
                        		<%
                        	}
                        }
                        %>
                    </table>
                    <div class="qwe">
                    <%
                    Pager pager=(Pager)request.getAttribute("pager");
                    if(pager!=null){
                    	for(int i=0;i<pager.getPageCount();i++){
                    		%>
                    		[<a class="number" href="javascript:void(0)"><%=i+1 %></a>]
                    		<%
                    	}
                    }
                    %>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
</div>
<jsp:include page="/manage/inc/footer.jsp"></jsp:include>
<style>
.qwe{
	text-align:center;
}
</style>
<script>
$(function(){
	$(".link-del").click(function() {
		
	if(!window.confirm("你确定要删除吗")){
		return false;
	}
	var id=$(this).attr("id").substring(3);
	$.get("<%=path%>/manage/VipServlet?action=delete",
			{id:id},
			function(){
				$("#tr"+id).remove();
			}
			)
	})
})
</script>